﻿using MiddlewareCore;
using MiddlewareCore.Middleware;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace NetFramworkDemo
{
    public class TestMiddleware : IMiddleware
    {
        private RequestDelegate _next;
        public TestMiddleware(RequestDelegate next) : base(next)
        {
            _next = next;
        }
        public async override Task Invoke(MiddlewareContext context)
        {
            string data = context.GetData<string>();
            Console.WriteLine($"这是实现IMiddleware的中间件,数据值：{data}");
            await _next.Invoke(context);
        }
    }
}
